---
category: Math
created: '2021-05-24'
title: Calculate the linear interpolation between two numbers
updated: '2021-10-13'
---

**JavaScript version**

```js lerp.js
const lerp = (a, b, amount) => (1 - amount) * a + amount * b;
```

**TypeScript version**

```ts lerp.ts
const lerp = (a: number, b: number, amount: number): number => (1 - amount) * a + amount * b;
```

## See also

-   [Linear scale of a number between two ranges](https://phuoc.ng/collection/1-loc/linear-scale-of-a-number-between-two-ranges/)
-   [Normalize the ratio of a number in a range](https://phuoc.ng/collection/1-loc/normalize-the-ratio-of-a-number-in-a-range/)
